<?php
	$first_name=$_POST["first_name"];
	$last_name=$_POST["last_name"];
	$login=$_POST["login"];
	$pass=$_POST["password"];
	$dossier = 'images/';
	$fichier = basename($_FILES['avatar']['name']);
	$taille_maxi = 100000;
	$taille = filesize($_FILES['avatar']['tmp_name']);
	$extensions = array('.png', '.gif', '.jpg', '.jpeg');
	$extension = strrchr($_FILES['avatar']['name'], '.'); 
	include("database.php");
	$requete="
		INSERT into users
		VALUES ('','$last_name','$first_name','images/$fichier','$login','$pass')
	";
	mysql_query($requete);
	
	$user = "
		SELECT id_users 
		FROM users
		WHERE pseudo_users =  '$login'
		AND surname_users =  '$last_name'
		AND firstname_users =  '$first_name'
		AND password_users= '$pass'
	";
	$info_user = mysql_query($user);
	while($info = mysql_fetch_assoc($info_user)){
		$id_user = $info['id_users'];	
	}
	session_start();
	$_SESSION["id_user"]=$id_user;
	header('Location: index.php');

?>
